/**
 * 作者：陈文斌 on 2019/1/26.
 * 邮箱：chen_wennbin@163.com
 * 版本：v1.0
 */

import 'package:flutter/material.dart';
import 'package:crm/constant/constant.dart';
import 'package:crm/view/AppBar/custom_app_bar.dart';
import 'package:crm/component/PainPoint/pain_point_detail_section.dart';
import 'package:crm/view/Tile/tile_space_between.dart';
import 'package:crm/view/Dialog/expansion_tile_dialog.dart';
import 'package:crm/page/PainPoint/add_pain_point_record_page.dart';

const String Title = '客户痛点详情';

class PainPointRecordDetailPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _PainPointRecordDetailPageState();
  }
}

class _PainPointRecordDetailPageState extends State<PainPointRecordDetailPage> {
  @override
  Widget build(BuildContext context) {
    openExtensionBar() {
      showDialog(
        context: context,
        builder: (context) {
          return ExpansionTileDialog(
            tiles: [
              ExpansionDialogTile.icon(
                icon: Icon(
                  Icons.share,
                  size: 14,
                ),
                title: '分享',
                onTap: () {
                  print('分享');
                  Navigator.pop(context);
                },
              ),
              ExpansionDialogTile.icon(
                icon: Icon(
                  Icons.share,
                  size: 14,
                ),
                title: '编辑',
                onTap: () {
                  Navigator.pop(context);
                  Navigator.push(
                    context,
                    MaterialPageRoute(
                      builder: (context) => AddPainPointRecordPage(),
                    ),
                  );
                },
              ),
              ExpansionDialogTile.icon(
                icon: Icon(
                  Icons.share,
                  size: 14,
                ),
                title: '删除',
                onTap: () {
                  print('删除');
                  Navigator.pop(context);
                },
              ),
            ],
          );
        },
      );
    }

    return Scaffold(
      appBar: CustomAppBar(
        title: Title,
        actions: <Widget>[
          MaterialButton(
            onPressed: () {
              // 打开扩展栏
              openExtensionBar();
            },
            child: Text(
              '更多',
              style: AppStyles.actionsTitleStyle,
            ),
            splashColor: Colors.transparent,
            highlightColor: Colors.transparent,
          ),
        ],
      ),
      body: SingleChildScrollView(
        child: Column(
          children: <Widget>[
            PaddingSet.PaddingTop(12),
            PainPointDetailSection(),
            PaddingSet.PaddingTop(10),
            TileSpaceBetween(
              color: Colors.white,
              height: 44,
              dividerVisible: false,
              title: Text(
                '记录人',
                style: TextStyle(
                  color: AppColors.DetailTextColor,
                  fontSize: AppFontSizes.Font15,
                  fontFamily: AppFontFamilies.PingFangSC,
                  fontWeight: FontWeight.w500,
                ),
              ),
              subtitle: Text(
                '林剑飞',
                style: TextStyle(
                  color: AppColors.PlaceholderTextColor,
                  fontSize: AppFontSizes.Font14,
                  fontFamily: AppFontFamilies.PingFangSC,
                  fontWeight: FontWeight.w500,
                ),
              ),
            ),
            TileSpaceBetween(
              color: Colors.white,
              height: 44,
              title: Text(
                '记录时间',
                style: TextStyle(
                  color: AppColors.DetailTextColor,
                  fontSize: AppFontSizes.Font15,
                  fontFamily: AppFontFamilies.PingFangSC,
                  fontWeight: FontWeight.w500,
                ),
              ),
              subtitle: Row(
                children: <Widget>[
                  Text(
                    '2017/6/22',
                    style: TextStyle(
                      color: AppColors.MainColor,
                      fontSize: AppFontSizes.Font12,
                      fontFamily: AppFontFamilies.PingFangSC,
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                  PaddingSet.PaddingRight(10),
                  Text(
                    '14:30',
                    style: TextStyle(
                      color: AppColors.MainColor,
                      fontSize: AppFontSizes.Font12,
                      fontFamily: AppFontFamilies.PingFangSC,
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
